
using System;
using System.Collections.Generic;
using System.Text;
using NFinal.Extension;

namespace WebApplication1.DDD.Models.Entity.Common
{
    public struct article_attachment:NFinal.IModel
    {
		public System.Int64 id;
		public System.Int64? article_id;
		public System.String file_name;
		public System.String file_path;
		public System.Int64? file_size;
		public System.String file_ext;
		public System.Int64? down_qty;
		public System.Int64? point;
		public System.DateTime? add_time;
		public System.Int64? user_id;
		#region Nullable
		private bool __is_null__;
        public bool __Is_Null__
        {
            get {
                return __is_null__;
            }
            set
            {
                 __is_null__=value;
            }
        }
        public static implicit operator article_attachment(string __value__)
        {
            var __value2__ = new article_attachment();
            __value2__.__Is_Null__ = __value__==null;
            return __value2__;
        }
        public static  bool operator true(article_attachment __value__)
        {
            return !__value__.__is_null__;
        }
        public static bool operator false(article_attachment __value__)
        {
            return !__value__.__is_null__;
        }
		#endregion
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out article_attachment par)
		{
			par=new article_attachment();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.article_id=null;
						if(get["article_id"]!=null)
						{
							par.article_id=get["article_id"].AsVar();
						}
						par.file_name=get["file_name"];
						par.file_path=get["file_path"];
						par.file_size=null;
						if(get["file_size"]!=null)
						{
							par.file_size=get["file_size"].AsVar();
						}
						par.file_ext=get["file_ext"];
						par.down_qty=null;
						if(get["down_qty"]!=null)
						{
							par.down_qty=get["down_qty"].AsVar();
						}
						par.point=null;
						if(get["point"]!=null)
						{
							par.point=get["point"].AsVar();
						}
						par.add_time=null;
						if(get["add_time"]!=null)
						{
							par.add_time=get["add_time"].AsVar();
						}
						par.user_id=null;
						if(get["user_id"]!=null)
						{
							par.user_id=get["user_id"].AsVar();
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"article_id\":");
					tw.Write(article_id==null?"null" : article_id.ToString());
					tw.Write(",");
					tw.Write("\"file_name\":");
					tw.Write("\"");
					tw.Write(file_name==null?"null":file_name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"file_path\":");
					tw.Write("\"");
					tw.Write(file_path==null?"null":file_path);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"file_size\":");
					tw.Write(file_size==null?"null" : file_size.ToString());
					tw.Write(",");
					tw.Write("\"file_ext\":");
					tw.Write("\"");
					tw.Write(file_ext==null?"null":file_ext);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"down_qty\":");
					tw.Write(down_qty==null?"null" : down_qty.ToString());
					tw.Write(",");
					tw.Write("\"point\":");
					tw.Write(point==null?"null" : point.ToString());
					tw.Write(",");
					tw.Write("\"add_time\":");
					tw.Write("\"");
					tw.Write(add_time==null?"null":add_time.ToString());
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"user_id\":");
					tw.Write(user_id==null?"null" : user_id.ToString());

			tw.Write("}");
		}
		#endregion
    }
}
